﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ScreenRemote
{
    public delegate void OptDelegate(int interval);

    public partial class FrmOptions : Form
    {
        private int rate;
        private OptDelegate optDelegate = null;

        public FrmOptions(int rate, OptDelegate optDelegate)
        {
            InitializeComponent();

            this.rate = rate;
            this.optDelegate = optDelegate;
        }

        private void FrmOptions_Load(object sender, EventArgs e)
        {
            this.txtRate.Text = (1000 / this.rate).ToString();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            if (this.optDelegate != null)
            {
                this.optDelegate(1000 / rate);
            }

            this.Close();
        }
    }
}
